<template>
  <div class="root">
    <graph :graph-data="graphData" :is-new-data="isNewData"></graph>
  </div>
</template>

<script setup>
import {onMounted, ref} from "vue";
import Graph from "@/components/graph/index.vue";
// import dataSet from "@/components/graph/config/graphData/data2.json";
import dataSet from "@/components/graph/config/graphData/data4.json";

let graphData = ref()
let isNewData = ref(true)
onMounted(() => {
  // 初始化数据
  initData()
})

function initData() {
  setTimeout(() => {
    if (localStorage.getItem('graphData')) {
      isNewData.value = false
      graphData.value = JSON.parse(localStorage.getItem('graphData'))
    } else {
      graphData.value = dataSet
    }
  }, 1000)
}
</script>

<style scoped lang="less">
.root {
  width: 100%;
  height: 100%;
  padding: 10px;
  background: lightgrey;
  box-sizing: border-box;
}
</style>
